﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Pages/Default.master" AutoEventWireup="true"
    CodeBehind="ServiceManage.aspx.cs" Inherits="AUV5.Web.Pages.ServiceManage" %>

<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <p class="usertitle">
        我发布的哎哟喂</p>
    <p class="goreg">
        当前共有 <span class="amount"><a href="/Pages/ServiceManage.aspx">
            <asp:Label ID="lbCount" runat="server" /></a></span> 个服务
    </p>
    <div class="servicemenu">
        <div class="fl servicemenu_left">
            <ul>
                <li><a href="/services/manage/Active">进行中：<span><asp:Label ID="lblActive" runat="server"></asp:Label></span></a></li>
                <li><a href="/services/manage/Suspended">挂起：<span><asp:Label ID="lblSuspended" runat="server"></asp:Label></span></a></li>
                <li class="borderno"><a href="/services/manage/PendingReview">等待审核：<span><asp:Label
                    ID="lblPendingReview" runat="server"></asp:Label></span></a></li>
            </ul>
        </div>
        <div class="fr">
            <a href="/Pages/ServiceAdd.aspx">
                <img src="/!images/btn_pubnewinfo.jpg" /></a>
        </div>
    </div>
    <p class="clear">
    </p>
    <div class="servicemanagelist">
        <ul>
            <asp:Repeater ID="repService" runat="server" OnItemDataBound="repService_ItemDataBound">
                <ItemTemplate>
                    <li>
                        <div class="padding">
                            <p class="serviceavatar">
                                <img src="<%#AUV5.BLL.UserInfoBLL.Instance.GetDetail((Container.DataItem as AUV5.Model.ServiceInfo).UserID).PhotoPath %>"
                                    alt="" />
                            </p>
                            <div class="serviceinfo">
                                <p class="servicetop">
                                    <%# getStatus((Container.DataItem as AUV5.Model.ServiceInfo).StatusID.ToString())%>
                                    <span class="servicestitle"><a href="/service/<%#(Container.DataItem as AUV5.Model.ServiceInfo).Title%>"
                                        target="_blank">
                                        <%#(Container.DataItem as AUV5.Model.ServiceInfo).Title %></a> 只需
                                        <%#(Container.DataItem as AUV5.Model.ServiceInfo).Price.ToString("0") %>
                                        元</span>
                                </p>
                                <p class="servicetxt">
                                    <span class="icon_good txtcolor">
                                        <%#(Container.DataItem as AUV5.Model.ServiceInfo).GoodRating%></span> <span class="icon_bad txtcolor">
                                            <%#(Container.DataItem as AUV5.Model.ServiceInfo).BadRating%></span> <span>
                                                <%#(Container.DataItem as AUV5.Model.ServiceInfo).ViewCount%>次浏览</span>
                                    <span>持续了<%#base.GetDaySpan((Container.DataItem as AUV5.Model.ServiceInfo).CreateDate)%>天</span>
                                    <span class="detail statusboxtxt" id="showdetail_<%#Container.ItemIndex%>">信息</span>
                                    <span id="showextra_<%#Container.ItemIndex%>" class="extra statusboxtxt" <%#(base.ExtraService_Enabled?"":"style='display:none'") %>>
                                        增值</span> <span id="showvideo_<%#Container.ItemIndex%>" class="servicevideo statusboxtxt">
                                            视频</span> <span class="servicevideo statusboxtxt"><a href="/Pages/Share.aspx?serviceID=<%#(Container.DataItem as AUV5.Model.ServiceInfo).ServiceID %>">
                                                分享成果</a> </span>
                                </p>
                                <p class="modifystatus">
                                    <asp:LinkButton ID="lbtnSuspend" CommandArgument="<%#(Container.DataItem as AUV5.Model.ServiceInfo).ServiceID %>"
                                        Text='<%#((Container.DataItem as AUV5.Model.ServiceInfo).StatusID==(int)AUV5.Common.Enum.ServiceStatus.Suspended)?"激活":"挂起"%>'
                                        OnClick="lbtnSuspend_Click" runat="server" />| <a href="/Pages/ServiceEdit.aspx?serviceID=<%#(Container.DataItem as AUV5.Model.ServiceInfo).ServiceID %>">
                                            编辑</a> |
                                    <asp:LinkButton ID="lbtnDel" OnClientClick="return confirm('确认删除该信息吗？')" CommandArgument="<%#(Container.DataItem as AUV5.Model.ServiceInfo).ServiceID %>"
                                        Text="删除" OnClick="lbtnDel_Click" runat="server" />
                                </p>
                            </div>
                            <p class="clear">
                            </p>
                        </div>
                    </li>
                    <li>
                        <div class="showdetail_<%#Container.ItemIndex%> statusinfolist hide">
                            <asp:HiddenField ID="hfServiceID" runat="server" Value="<%#(Container.DataItem as AUV5.Model.ServiceInfo).ServiceID %>" />
                            <ul>
                                <li>
                                    <p class="colortxt">
                                        服务信息</p>
                                    <p class="greytxt">
                                        发布于：
                                        <%#(Container.DataItem as AUV5.Model.ServiceInfo).CreateDate.ToString("MM月dd日 HH:mm")%></p>
                                    <p>
                                        类别：
                                        <%#(Container.DataItem as AUV5.Model.ServiceInfo).CategoryName %>
                                    </p>
                                </li>
                                <li>
                                    <p class="colortxt">
                                        <asp:Label ID="lbOrderCount" Text="" runat="server" />
                                        个订单</p>
                                    <p class="greytxt">
                                        还有
                                        <asp:Label ID="lbUnFinishedOrderCount" Text="" runat="server" />
                                        个未完成</p>
                                    <p class="bluetxt">
                                        <a href="/Pages/OrderList.aspx" target="_blank">查看订单详情</a></p>
                                </li>
                                <li class="padno">
                                    <p class="colortxt">
                                        创造了￥
                                        <asp:Label ID="lbIncome" Text="" runat="server" />
                                        财富</p>
                                    <p class="greytxt">
                                        还有 ￥
                                        <asp:Label ID="lbUnFinishedIncome" Text="" runat="server" />
                                        没赚到手</p>
                                    <p>
                                        <a href="/Pages/OrderList.aspx">查看收入详情</a></p>
                                </li>
                            </ul>
                            <p class="clear">
                            </p>
                        </div>
                        <div class="showextra_<%#Container.ItemIndex%> statusinfolist hide">
                            <div class="addextraservice">
                                <p>
                                    我还可以</p>
                                <p>
                                    <input class="extraTitle" type="text" name="" value="" /></p>
                                <p>
                                    需增加</p>
                                <p>
                                    <select class="extraPrice">
                                        <option value="value">5</option>
                                        <option value="value">15</option>
                                        <option value="value">25</option>
                                        <option value="value">50</option>
                                    </select>
                                </p>
                                <p>
                                    <img id="addExtra" class="addExtra" src="/!images/btn_releaseon.png" onmouseover="MM_swapImage('addExtra','','/!images/btn_releaseoff.png',5)"
                                        onmouseout="MM_swapImgRestore()" alt="发布" /></p>
                                <input type="hidden" name="" value="<%#(Container.DataItem as AUV5.Model.ServiceInfo).ServiceID %>" />
                            </div>
                            <p class="error marno">
                            </p>
                            <div class="extralist">
                                <asp:Repeater runat="server" DataSource="<%#(Container.DataItem  as AUV5.Model.ServiceInfo).ExtraList %>">
                                    <ItemTemplate>
                                        <p>
                                            <%#(Container.DataItem as AUV5.Model.ExtraService).Title %>
                                            需添加<%#(Container.DataItem as AUV5.Model.ExtraService).Price.ToString("0") %>元 <span
                                                class="extralistdel"><a class="extradel" id='<%#(Container.DataItem as AUV5.Model.ExtraService).ExtraID %>'
                                                    href="">删除</a> </span>
                                        </p>
                                    </ItemTemplate>
                                </asp:Repeater>
                            </div>
                            <p class="clear">
                            </p>
                        </div>
                        <div class="showvideo_<%#Container.ItemIndex%> statusinfolist hide">
                            <%--添加视频--%>
                            <asp:Panel ID="addVideo" class="service_video" runat="server" Visible="false">
                                <p class="fl">
                                    <img src="/!images/addvideo.jpg" /></p>
                                <div class="service_videotxt">
                                    <p class="bold">
                                        添加一条视频</p>
                                    <p>
                                        您可以通过视频来展示您多自己服务的介绍，从而使买家可以更直观的了解您的服务</p>
                                </div>
                                <p class="btn_servicevideo">
                                    <a href="/Pages/ServiceVideo.aspx?serviceID=<%#(Container.DataItem as AUV5.Model.ServiceInfo).ServiceID %>">
                                        <img src="/!images/btn_addvideo.png" alt="" /></a>
                                </p>
                            </asp:Panel>
                            <%--删除视频--%>
                            <asp:Panel ID="deleteVideo" class="service_video" runat="server" Visible="false">
                                <p class="fl">
                                    <asp:Image ID="imgVideo" ImageUrl="" runat="server" />
                                </p>
                                <div class="service_videotxt">
                                    <p class="bold">
                                        <asp:Label ID="lbStatus" Text="" runat="server" />
                                    </p>
                                    <p>
                                        时长：<asp:Label ID="lbDuration" Text="" runat="server" />
                                    </p>
                                    <p>
                                        您已经拥有了视频，如果您有更好的视频，您可以删除视频并重新上传。</p>
                                </div>
                                <p class="btn_servicevideo">
                                    <a href="/Pages/ServiceVideo.aspx?serviceID=<%#(Container.DataItem as AUV5.Model.ServiceInfo).ServiceID %>">
                                        <img src="/!images/btn_delvideo.png" alt="" /></a>
                                </p>
                            </asp:Panel>
                        </div>
                    </li>
                    <div class="clear">
                    </div>
                </ItemTemplate>
            </asp:Repeater>
        </ul>
    </div>
    <div class="servicemanagepage">
        <div class="pages">
            <webdiyer:AspNetPager ID="AspNetPager1" runat="server" OnPageChanged="AspNetPager1_PageChanged"
                CustomInfoHTML="共%PageCount%页，当前为第%CurrentPageIndex%页" PageIndexBoxType="DropDownList"
                PagingButtonLayoutType="Span" SubmitButtonText="Go" TextAfterPageIndexBox="页"
                TextBeforePageIndexBox="转到" PageSize="8" PagingButtonSpacing="" CurrentPageButtonClass="currentpage"
                ButtonImageExtension=".jpg" ImagePath="/!images/" ShowPageIndexBox="Never">
            </webdiyer:AspNetPager>
        </div>
    </div>
    <div class="statusbox">
        <p class="statusboxtit">
            <a href="#">点此查看服务状态的含义</a></p>
        <div class="statuslist">
            <ul>
                <li>
                    <p class="green">
                        进行中</p>
                    <span>正在进行中的服务，所有人都能看到并且购买您的服务。</span></li>
                <li>
                    <p class="light_gray">
                        挂起</p>
                    <span>没有人能看到你发布的服务，如果你愿意，可以随时激活该服务。</span></li>
                <li>
                    <p class="red">
                        未通过审核</p>
                    <span>您的服务未通过审核，其他人都不可见。</span></li>
                <li>
                    <p class="dark_gray">
                        正等待审核</p>
                    <span>您的服务正在审核中，其他人都不可见。</span></li>
                <li>
                    <p class="orange">
                        发送中</p>
                    <span>正在发送中的服务</span></li>
                <li>
                    <p class="pink">
                        精选</p>
                    <span>太棒了!您的服务被我们精选显示到了主页上！</span></li>
            </ul>
        </div>
    </div>
    <script type="text/javascript">
        $(function () {
            // 状态显示和隐藏
            $(".statusboxtit").click(function (e) {
                $(".statuslist").toggle();
                preventDefault(e);
            });
            $('.statusboxtxt').mouseover(function () {
                $(this).addClass('statusboxhover');
            });
            $('.statusboxtxt').mouseout(function () {
                $(this).removeClass('statusboxhover');
            });
            $('.statusboxtxt').click(function () {
                if (!$(this).hasClass('statusboxselect')) {
                    //隐藏所有
                    $(this).parentsUntil($('li')).next('li').children().each(function () {
                        $(this).hide();
                    });
                    $(this).parent().children().each(function () {
                        $(this).removeClass('statusboxhover');
                        $(this).removeClass('statusboxselect');
                    });
                }
                $(this).toggleClass('statusboxselect');
                $(this).parentsUntil($('li')).next('li').find('.' + this.id).toggle();
            });

            //添加增值服务
            $('.addExtra').click(function () {
                var parent = $(this).parent().parent();
                var id = $(parent).find('input:hidden').val();
                var title = $(parent).find('.extraTitle').val();
                var price = $(parent).find('.extraPrice').find('option:selected').text();
                $.ajax({
                    url: '/Handler/ServiceHandler.ashx',
                    type: 'post',
                    data: { ServiceID: id, Title: title, Price: price, Command: 'Add' },
                    success: function (response) {
                        if (response == '100') {
                            var newrecord = $('<p>').text(title + '需添加' + price + '元').fadeIn('slow');
                            $(parent).parent().find('.extralist').append(newrecord);
                        }
                        else {
                            $(parent).parent().find('.error').text(response);
                        }
                    }
                });
            });

            //删除增值服务
            $('.extradel').click(function (e) {
                if (confirm('确定要删除该记录吗？')) {
                    var id = this.id;
                    var node = this;
                    $.ajax({
                        url: '/Handler/ServiceHandler.ashx',
                        type: 'post',
                        data: { ServiceID: id, Command: 'Delete' },
                        success: function (response) {
                            if (response == '100') {
                                $(node).parent().parent().fadeOut('slow');
                            }
                        }
                    });
                }
                preventDefault(e)
            });

        })
    </script>
</asp:Content>
